﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace ActiveDirectory.Models
{
    public class AdDatabaseInit : DropCreateDatabaseAlways<AdContext>
    {
        protected override void Seed(AdContext context)
        {
            base.Seed(context);

            var adList = new List<AdAdmin>
            {
                new AdAdmin
                {
                    Name = "Dani",
                    Groups = new List<AdGroup>
                    {
                        new AdGroup {Name = "Faktura Power Users", AdGuid = Guid.NewGuid()},
                        new AdGroup {Name = "Faktura Admins", AdGuid = Guid.NewGuid()}
                    }
                }
            };

            var adUser = new List<AdUser>
            {
                new AdUser {AdGuid = Guid.NewGuid(), Name = "brett will",wrapme = true},
                new AdUser {AdGuid = Guid.NewGuid(), Name = "shawn islit"},
                new AdUser {AdGuid = Guid.NewGuid(), Name = "dooby doo", wrapme = true},
                new AdUser {AdGuid = Guid.NewGuid(), Name = "another user"},
                new AdUser {AdGuid = Guid.NewGuid(), Name = "third user"},
            };

            adUser.ForEach(x => context.AdUsers.Add(x));

            adList.ForEach(x => context.AdAdmins.Add(x));

            context.SaveChanges();
        }
    }
}